<?php
/*
 * @Author: zwx
 * @Date: 2024-05-30 12:05:58
 * @LastEditors: zwx
 * @LastEditTime: 2024-07-13 17:53:58
 * @Description: 
 */
declare(strict_types=1);

namespace app\apiadmin\command;

use app\apiadmin\controller\behavior\Invitation;
use app\apiadmin\controller\liveManager\LiveStatus;
use app\apiadmin\service\invitation\InvitationService;
use app\apiadmin\service\TCSS\TImService;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Db;

class siyu_dabiaoqian extends Command
{

    protected function configure()
    {
        // 命令的名称及用途描述
        $this->setName('siyu_dabiaoqian')->setDescription('给私域直播邀约的人打到课标签和成交标签');
    }

    protected function execute(Input $input, Output $output)
    {
        // 你的后台运行代码
        $output->writeln("siyu_dabiaoqian");
        // 这里可以放置你的长时间运行的代码
        while (true) {

            try {
                //获取直播id
                $ls = new LiveStatus(1);
                $liveId = $ls->get_dabiaoqian_live();

                if (!empty($liveId)) {
                    dump($liveId);
                    dump('取到了----' . $liveId[0]);
                    InvitationService::_xiaoSiyuBiaoQian($liveId[1]);
                } else {
                    dump('sleep1');
                    sleep(1);
                    dump('sleep2');
                }
            } catch (\Throwable $th) {
                dump('报错了-----------------------------------------------------');
                dump($th);
            }

        }


        // $ls = new LiveStatus(1);
        // $liveId = $ls->set_dabiaoqian_live(200);

    }


}